# -*- coding: UTF-8 -*-
#这个代码对比一下read()，readline()和readlines()函数
file_read = open('D:/testGit/Test/a.txt',encoding = 'utf-8')
print (file_read.read())
print (type(file_read.read()))
for a in range(1,20):
    ab = file_read.readlines()
    if a != ab:
        print(ab)

file_read.close()

with open('D:/testGit/Test/a.txt','r',encoding = 'utf-8') as f:
    line2 = f.readlines()
    line2_num = len(line2)
    print(line2)
    print(line2_num)



def readtxtfile(n):
    filelujin = open('D:/testGit/Test/a.txt',encoding = 'utf-8')
    lines = filelujin.readlines(n)
    filelujin.close()
    return lines

def textread ():
    lines0=[]
    for i in range(1,100):
        lines1 = readtxtfile(i)
        if lines0 != lines1:
            print(f"read {i} chacters:")
            for l in lines1: print(l, end='')
            lines0 = lines1
            print('\n')
